package com.sbr.esbmonitor.camel.model;

import java.util.HashMap;
import java.util.Map;

public class Endpoint {

	private String componentName;
	private String name;
	private Map<String, String> parameters = new HashMap<String, String>();

	public Endpoint() {
	}

	public Endpoint(String componentName, String name, Map<String, String> parameters) {
		this.componentName = componentName;
		this.name = name;
		this.parameters = parameters;
	}

	public String getComponentName() {
		return componentName;
	}

	public String getName() {
		return name;
	}

	public Map<String, String> getParameters() {
		return parameters;
	}

	@Override
	public String toString() {
		return "Endpoint [componentName=" + componentName + ", name=" + name
				+ ", parameters=" + parameters + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((componentName == null) ? 0 : componentName.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((parameters == null) ? 0 : parameters.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Endpoint other = (Endpoint) obj;
		if (componentName == null) {
			if (other.componentName != null)
				return false;
		} else if (!componentName.equals(other.componentName))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (parameters == null) {
			if (other.parameters != null)
				return false;
		} else if (!parameters.equals(other.parameters))
			return false;
		return true;
	}
	
}
